Socket
Socket
Sign inDemoInstall

@ethersproject/solidity

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethersproject/solidity

Solidity coder for non-standard (tight) packing.


Version published
Weekly downloads
637K
decreased by-1.62%
Maintainers
1
Weekly downloads
 
Created

What is @ethersproject/solidity?

@ethersproject/solidity is a part of the ethers.js library, which provides utilities for interacting with the Ethereum blockchain. This specific package focuses on Solidity-related functionalities, such as hashing and encoding data according to Solidity's rules.

What are @ethersproject/solidity's main functionalities?

Solidity Keccak256

This feature allows you to compute the Keccak256 hash of Solidity-encoded data. The example demonstrates hashing a string 'Hello, world!' using Solidity's encoding rules.

const { keccak256 } = require('@ethersproject/solidity');
const hash = keccak256(['string'], ['Hello, world!']);
console.log(hash);

Solidity Pack

This feature allows you to pack multiple Solidity types into a single byte array. The example shows how to pack a uint256 and an address into a byte array.

const { pack } = require('@ethersproject/solidity');
const packedData = pack(['uint256', 'address'], [12345, '0x742d35Cc6634C0532925a3b844Bc454e4438f44e']);
console.log(packedData);

Solidity AbiCoder

This feature provides an ABI coder for encoding and decoding Solidity data types. The example demonstrates encoding a uint256 and a string into ABI format.

const { AbiCoder } = require('@ethersproject/solidity');
const abiCoder = new AbiCoder();
const encoded = abiCoder.encode(['uint256', 'string'], [12345, 'Hello, world!']);
console.log(encoded);

Other packages similar to @ethersproject/solidity

Keywords

FAQs

Package last updated on 19 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc